#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

class Solution
{
public:
    int numFriendRequests(vector<int>& ages)
    {
		sort(ages.begin(), ages.end());
		int cnt = 0;
		int right = ages.size() - 1;
		int left = right - 1;
		while (right)
		{
			
			if (ages[left] <= 0.5 * ages[right] + 7
				|| ages[left] > ages[right]
				|| ages[left] > 100 && ages[right] < 100)
			{ }
			else
			{
				cnt++;
				//cout << ages[right] << "->" << ages[left] << endl;
				if (ages[right] <= 0.5 * ages[left] + 7
					|| ages[right] > ages[left]
					|| ages[right] > 100 && ages[left] < 100)
				{ }
				else
				{
					cnt++;
					//cout << ages[left] << "->" << ages[right] << endl;
				}
			}
			left--;
				
			if (left < 0)
			{
				right--;
				left = right - 1;
			}
		}
		return cnt;
    }
};
int main()
{
	vector<int> a{ 101,56,69,48,30 };

	Solution xz;
	int n = xz.numFriendRequests(a);
	cout << n << endl;
	return 0;
}